from frontend.roleApplication import RoleApplication
from frontend.form import Type

class Employee(RoleApplication):
    
    def __init__(self):
        super(Employee, self).__init__("Restock2", "Employee") 
        self.register_transition_step("Stockroom", self.Start_StockCheck)
        self.register_transition_step("FetchNew", self.Start_FetchNewItem)
        self.register_transition_step("PlaceOnFloor", self.Start_PlaceOnSalesFloor)
        self.register_transition_step("PlaceNew", self.Start_PlaceOnSalesFloorRep)

    
    def Start_StockCheck(self, stepname, form):
        form.add_task_label(fields=["ItemNumber", "Size", "Color"]);
        form.add_static_label('Your manager has found items that must be re-stocked')
        form.add_static_label('Is this item available in the stockroom?')
        form.add_field(Type.BOOLEAN, "itemavailable")

    def Start_FetchNewItem(self, stepname, form):
        form.add_task_label(fields=["NewItemNumber", "NewSize", "NewColor"]);
        form.add_static_label('Your manager would like to replace the unavailable item with the item above')
        form.add_static_label('Has the new item been fetched from the stockroom?')
        form.add_field(Type.BOOLEAN, "itemfetched")
        
    def Start_PlaceOnSalesFloor(self, stepname, form):
        form.add_task_label(fields=["ItemNumber", "Size", "Color"]);
        form.add_static_label('Has the following item been placed on the sales floor?')
        form.add_field(Type.BOOLEAN, "placementcomplete")

    def Start_PlaceOnSalesFloorRep(self, stepname, form):
        form.add_task_label(fields=["NewItemNumber", "NewSize", "NewColor"]);
        form.add_static_label('Has the following item been placed on the sales floor?')
        form.add_field(Type.BOOLEAN, "placementcompletenew")        
    
if __name__ == '__main__':
    app = Employee()
    app.MainLoop()